package com.example.java_websocket.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

@Configuration
public class WebSocketConfigAnno {
    /**
     * 注册了此Bean才能使用注解WebSocket
     */
    // 关键！注册@ServerEndpoint注解的Bean

    public WebSocketConfigAnno(){
        System.out.println("加载WebSocketConfigAnno构造方法");
    }

    @Bean
    public ServerEndpointExporter serverEndpointExporter() {

        return new ServerEndpointExporter();
    }
}
